/**
 * 
 * 技能快捷栏
 * 
 */
class SkillControl extends egret.DisplayObjectContainer {

    private attack_png: egret.Bitmap = Utils.createBitmapByName("close_png");
    /** 面板容器 */
    public context: egret.Sprite = new egret.Sprite();

    public constructor() {
        super();
        this.once(egret.Event.ADDED_TO_STAGE, this.init, this);
    }

    private init() {
        this.addChild(this.context);
        Utils.anchorCenter(this.context);
        this.context.x = this.stage.stageWidth * .8;
        this.context.y = this.stage.stageHeight * .8;

        this.drawAttackBtn();
    }

    private drawAttackBtn() {
        this.context.addChild(this.attack_png);
        Utils.anchorCenter(this.attack_png);
        this.attack_png.touchEnabled = true;
        this.attack_png.addEventListener(egret.TouchEvent.TOUCH_TAP, this.attackBtnCallBack, this);
    }

    public attackBtnCallBack() {
        console.log("按下了攻击键");

        this.dispatchEvent(new egret.Event("attack"));
    }

}